﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script src="../../Scripts/fckeditor/fckeditor.js" type="text/javascript"></script>
	<script type="text/javascript">
	    window.onload = function () {
	        var objFckEditor = new FCKeditor('GocChiaSe_NoiDung');
	        objFckEditor.BasePath = '<%= ResolveUrl("~/Scripts/fckeditor/")%>';
	        objFckEditor.Height = 380;
	        objFckEditor.Width = 542;
	        objFckEditor.ToolbarSet = 'TemplateWeb.MyToolbar';
	        objFckEditor.ReplaceTextarea();
	    }
	</script>
    <script type="text/javascript">
        function ValidateGocChiaSe() {
	        var tieude = document.getElementsByName("GocChiaSe_TieuDe").item(0);
	        if (tieude.value == "") {
	            alert("Bạn chưa nhập tiêu đề");
	            return false;
	        }
	        var noidung = FCKeditorAPI.GetInstance("GocChiaSe_NoiDung");
	        if (noidung.GetHTML() == "") {
	            alert("Bạn chưa nhập nội dung");
	            return false;
	        }
	        var noidungrutgon = document.getElementsByName("GocChiaSe_NoiDungRutGon").item(0);
	        if (noidungrutgon.value == "") {
	            alert("Bạn chưa nhập nội dung rút gọn");
	            return false;
	        }
	        return true;
	    }

        <% if (ViewData["ThemBaiChiaSe"] != null)
           { %>
		    alert('<%= ViewData["ThemBaiChiaSe"]%>');
	    <% } %>
    </script>
    <div class="content_panel">
        <div class="box_center">
	        <div class="title"><span>Thêm bài chia sẻ</span><div class="bg"><img src="../../Content/Images/Home/bg_title_right.png" /></div></div>
	        <div class="content">
            <% using (Html.BeginForm("InsertGocChiaSe", "Home", FormMethod.Post, new { enctype = "multipart/form-data", onsubmit = "return ValidateGocChiaSe();" }))
	            { %>
		            <div style="padding-top: 10px">
			            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="AdminPageText">
				            <tbody>
					            <tr>
						            <td>
							            <div align="left" style="padding-top:15px;">
								            <font class="normal8">Tiêu đề: </font>
							            </div>
						            </td>
					            </tr>
                                <tr>
                                    <td height="20">
							            <div align="left" style="padding-top:5px">
								            <%= Html.TextBox("GocChiaSe_TieuDe", "", new { @style = "width: 540px;" })%>
							            </div>
						            </td>
                                </tr>
					            <tr>
						            <td>
							            <div align="left" style="padding-top:15px">
								            <font class="normal8">Nội dung: </font>
							            </div>
						            </td>
					            </tr>
                                <tr>
                                    <td height="20">
							            <div align="left" style="padding-top:5px">
								            <%= Html.TextArea("GocChiaSe_NoiDung")%>
							            </div>
						            </td>
                                </tr>
					            <tr>
						            <td>
							            <div align="left" style="padding-top:15px">
								            <font class="normal8">Nội dung rút gọn: </font>
							            </div>
						            </td>
					            </tr>
                                <tr>
                                     <td height="20">
							            <div align="left" style="padding-top:5px">
								            <textarea name="GocChiaSe_NoiDungRutGon" style="width: 540px; height: 80px;"></textarea>
							            </div>
						            </td>
                                </tr>
					            <tr>
						            <td>
							            <div align="left" style="padding-top:15px">
								            <font class="normal8">Hình minh họa: </font>
							            </div>
						            </td>
					            </tr>
                                <tr>
                                    <td height="20">
							            <div align="left" style="padding-top:5px">
								            <input type="file" name="GocChiaSe_HinhMinhHoa" />
							            </div>
						            </td>
                                </tr>
                                <tr>
                                    <td height="20">
							            <div align="left">
								            <br/>
								            <p>
                                                <input type="hidden" name="GocChiaSe_TenNguoiChiaSe" value="<%= Page.User.Identity.Name %>" />
									            <input type="submit" name="sbt" id="sbt" value="Thêm bài chia sẻ" style="background-image: url(../../../Content/Images/Home/bgbutton.jpg); color: #FFFFFF; font-size: 16px; font-weight: bold; border: 1px #DBDBDB solid; height: 30px; cursor:pointer;" />
								            </p>
							            </div>
						            </td>
                                </tr>
				            </tbody>
			            </table>
		            </div>
	            <% } %>
            </div>
        </div>
    </div>

</asp:Content>
